package com.neusoft.neuiotms.dcom.converter;

import org.springframework.stereotype.Component;

import com.neusoft.bizcore.web.dto.AbstractConverter;
import com.neusoft.neuiotms.dcom.dto.SchedulingRuleItemDTO;
import com.neusoft.neuiotms.dcom.model.SchedulingRuleItem;

@Component
public class SchedulingRuleItemConverter extends AbstractConverter<SchedulingRuleItem, SchedulingRuleItemDTO> {

    @Override
    public SchedulingRuleItem toModel(final SchedulingRuleItemDTO dto) {

        final SchedulingRuleItem model = new SchedulingRuleItem();

        model.setClassesItemCode(dto.getClassesItemCode());
        model.setClassesItemName(dto.getClassesItemName());
        model.setCyclicalNumber(dto.getCyclicalNumber());
        model.setEndTime(dto.getEndTime());
        model.setStartTime(dto.getStartTime());
        model.setGroupName(dto.getGroupName());
        model.setGroupNumber(dto.getGroupNumber());

        return model;
    }

    @Override
    public SchedulingRuleItemDTO toDTO(final SchedulingRuleItem model, final boolean forListView) {

        final SchedulingRuleItemDTO dto = new SchedulingRuleItemDTO();

        dto.setId(model.getId());
        dto.setClassesItemCode(model.getClassesItemCode());
        dto.setClassesItemName(model.getClassesItemName());
        dto.setCyclicalNumber(model.getCyclicalNumber());
        dto.setEndTime(model.getEndTime());
        dto.setStartTime(model.getStartTime());
        dto.setGroupName(model.getGroupName());
        dto.setGroupNumber(model.getGroupNumber());

        return dto;
    }

}
